<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title>联系人</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.css" rel="stylesheet" />
		<link rel="stylesheet" href="../fonts/iconfont.css">
		<link rel="stylesheet" href="../css/myapp.css">
		<style type="text/css">
			.mui-control-content {
				background-color: white;
				min-height: 600px;
			}

			.mui-control-content .mui-loading {
				margin-top: 50px;
			}

			#slider {
				background-color: white;
			}

			.mui-contents {
				margin-top: 3px;
			}

			#heard2 {
				margin-top: 4px;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a data-type="showtool" onclick="openaddWin()" class="iconfont icon-jiaguanzhu mui-pull-right"></a>
			<img class="mui-pull-left" src="../images/touxiang.jpg" onerror="../images/touxiang.jpg"/> 
			<h1 class="mui-title">联系人</h1>
		</header>
		<div class="heard1">
			<div class="mui-input-row mui-search">
				<input type="search" class="mui-input-clear" placeholder="" disabled="disabled" data-input-clear="1"
				 data-input-search="1">
				<span class="mui-placeholder"><span class="mui-icon mui-icon-search">
					</span><span>搜索</span></span>
			</div>
		</div>
		<div id="heard2">
			<ul class="mui-table-view">
				<li class="mui-table-view-cell">
					<a class="mui-navigate-right">
						新朋友
					</a>
				</li>
				<li class="mui-table-view-cell">
					<a class="mui-navigate-right">
						创建群聊
					</a>
				</li>
			</ul>
		</div>

		<div class="mui-contents" id="mui-contents">
			<div id="slider" class="mui-slider">
				<div id="sliderSegmentedControl" class="mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
					<a class="mui-control-item mui-active" href="#item1mobile">
						好友
					</a>
					<a class="mui-control-item" href="#item2mobile">
						群聊
					</a>
					<a class="mui-control-item" href="#item3mobile">
						通讯录
					</a>
					<a class="mui-control-item" href="#item4mobile">
						公众号
					</a>
				</div>
				<div id="sliderProgressBar" class="mui-slider-progress-bar mui-col-xs-3"></div>
				<div class="mui-slider-group" id="mui-slider-group_id">
					<div id="item1mobile" class="mui-slider-item mui-control-content mui-active">
						<div id="scroll1" class="mui-scroll-wrapper">
							<div class="mui-scroll">
								<ul class="mui-table-view">
									<li class="mui-table-view-cell">
										第一个选项卡子项-1
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-2
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-3
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-4
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-5
									</li>

									<li class="mui-table-view-cell">
										第一个选项卡子项-18
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-19
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-20
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-20
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-20
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-20
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-20
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-20
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-20
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-20
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-20
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-20
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-20
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-20
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-20
									</li>
									<li class="mui-table-view-cell">
										第一个选项卡子项-20
									</li>
								</ul>
							</div>
						</div>
					</div>
					<div id="item2mobile" class="mui-slider-item mui-control-content">
						<div id="scroll2" class="mui-scroll-wrapper">
							<div class="mui-scroll">
								<div class="mui-loading">
									<div class="mui-spinner">
									</div>
								</div>
							</div>
						</div>

					</div>
					<div id="item3mobile" class="mui-slider-item mui-control-content">
						<div id="scroll3" class="mui-scroll-wrapper">
							<div class="mui-scroll">
								<div class="mui-loading">
									<div class="mui-spinner">
									</div>
								</div>
							</div>
						</div>

					</div>
					<div id="item4mobile" class="mui-slider-item mui-control-content">
						<div id="scroll4" class="mui-scroll-wrapper">
							<div class="mui-scroll">
								<div class="mui-loading">
									<div class="mui-spinner">
									</div>
								</div>
							</div>
						</div>

					</div>
				</div>
			</div>

		</div>

		<script src="../js/mui.js"></script>
		<script type="text/javascript">
			mui.init({
				swipeBack: false
			});
			(function($) {
				$('.mui-scroll-wrapper').scroll({
					indicators: true //是否显示滚动条
				});
				var html2 =
					'<ul class="mui-table-view"><li class="mui-table-view-cell">第二个选项卡子项-1</li><li class="mui-table-view-cell">第二个选项卡子项-2</li><li class="mui-table-view-cell">第二个选项卡子项-3</li><li class="mui-table-view-cell">第二个选项卡子项-4</li><li class="mui-table-view-cell">第二个选项卡子项-5</li></ul>';
				var html3 =
					'<ul class="mui-table-view"><li class="mui-table-view-cell">第三个选项卡子项-1</li><li class="mui-table-view-cell">第三个选项卡子项-2</li><li class="mui-table-view-cell">第三个选项卡子项-3</li><li class="mui-table-view-cell">第三个选项卡子项-4</li><li class="mui-table-view-cell">第三个选项卡子项-5</li></ul>';
				var html4 =
					'<ul class="mui-table-view"><li class="mui-table-view-cell">第三个选项卡子项-1</li><li class="mui-table-view-cell">第三个选项卡子项-2</li><li class="mui-table-view-cell">第三个选项卡子项-3</li><li class="mui-table-view-cell">第三个选项卡子项-4</li><li class="mui-table-view-cell">第三个选项卡子项-5</li></ul>';
				var item2 = document.getElementById('item2mobile');
				var item3 = document.getElementById('item3mobile');
				var item4 = document.getElementById('item4mobile');
				document.getElementById('slider').addEventListener('slide', function(e) {
					if (e.detail.slideNumber === 1) {
						if (item2.querySelector('.mui-loading')) {
							setTimeout(function() {
								item2.querySelector('.mui-scroll').innerHTML = html2;
							}, 500);
						}
					} else if (e.detail.slideNumber === 2) {
						if (item3.querySelector('.mui-loading')) {
							setTimeout(function() {
								item3.querySelector('.mui-scroll').innerHTML = html3;
							}, 500);
						}
					} else if (e.detail.slideNumber === 3) {
						if (item4.querySelector('.mui-loading')) {
							setTimeout(function() {
								item4.querySelector('.mui-scroll').innerHTML = html4;
							}, 500);
						}
					}
				});
				
			})(mui);

			//滑动起始坐标
			var starty;
			//上下拉动监听
			document.getElementById('mui-slider-group_id').addEventListener('touchstart', touches, false);
			document.getElementById('mui-slider-group_id').addEventListener('touchmove', touches, false);
			document.getElementById('mui-slider-group_id').addEventListener('touchend', touches, false);
			function touches(ev) {
				switch (ev.type) {
					case 'touchstart':
						ev.preventDefault();
						starty = ev.touches[0].clientY;
						console.log("起始Y==>" + ev.touches[0].clientY);
						break;
					case 'touchmove':
						if ((ev.changedTouches[0].clientY - starty) < 0) {
							ev.preventDefault();
							var heardtop = document.getElementById('mui-contents').offsetTop;
							if (heardtop > 30) {
								console.log("距离顶部高度：" + heardtop);
								
								//mui('.mui-scroll')[0].scroll().setStopped(true);
							}
						}
						console.log("移动Y==>" + ev.changedTouches[0].clientY);
			
						break;
					case 'touchend':
						console.log("终止Y==>" + ev.changedTouches[0].clientY);
						break;
				}
			}

			//打开左侧菜单
			mui('header').on('tap', 'img', function(e) {
				var pmenu = plus.webview.getWebviewById("drag-left-menu");
				pmenu.show('slide-in-left', 200);
				setTimeout(function() {
					pmenu.evalJS("$('body>div:first').addClass('fullmsk')");
				}, 50);
			});
			// 打开添加好友界面
			function openaddWin() {
				var addfreandWin = plus.webview.getWebviewById("findFriends");
				//console.log(toolmenuWin);
				if (addfreandWin == null) {
					addfreandWin = plus.webview.create('addfriends/findFriends.html', 'findFriends', {
						top: '0px'
					});
				};
				addfreandWin.show("slide-in-right", 200);
			}
		</script>
	</body>

</html>
